#include <iostream>
#include "windows.h"

using namespace std ;

#include <ProToolkit.h>
#include <ProCore.h>
#include <ProMenu.h>
#include <ProMenuBar.h>
#include <ProWstring.h>
#include <ProMessage.h>
#include <ProUtil.h>

#include <ProSection.h>
#include <ProSecerror.h>
#include <ProMdl.h>
#include <Pro2dEntdef.h>
#include <ProFeature.h>
#include <ProFeatType.h>
#include <ProSolid.h>
#include <ProWindows.h>

extern "C" int MenuFunction();

static ProName msgfil;

extern "C" int MenuFunction()
{
	MessageBox(NULL, L"This is a message from a ProTK App", L"Pro/Toolkit App", MB_OK);
	return 0;
}

static uiCmdAccessState TestAccessDefault(uiCmdAccessMode access_mode)
{
    return (ACCESS_AVAILABLE);
}

/*===========================================================================*\
  Function : main
  Purpose  : Call the ProToolkitMain() function. main is optional function.
\*===========================================================================*/
extern "C" int main(int argc, char **argv)
{
	ProToolkitMain(argc, argv);
    return(0);
}

/*===========================================================================*\
  Function : user_initialize
  Purpose  : Required entry point for Pro/Toolkit
\*===========================================================================*/

extern "C" int user_initialize()
{
	uiCmdCmdId menu_id;
	ProError status;

	status = ProMenubarMenuAdd( "Menu", "MenuLabel", "Help", PRO_B_FALSE, ProStringToWstring(msgfil, "menu.txt"));

	ProCmdActionAdd("Menu", (uiCmdCmdActFn)MenuFunction, uiProe2ndImmediate, TestAccessDefault, PRO_B_TRUE, 
		PRO_B_TRUE, &menu_id);
    
	ProMenubarmenuPushbuttonAdd("Menu", "PushButton", "PushButton", "PushButton",
		NULL, PRO_B_TRUE, menu_id, ProStringToWstring(msgfil, "menu.txt"));

	return 0;
}

extern "C" void user_terminate()
{
	return;
}